package com.wuhainan.beelzebub.controller.system;

import com.wuhainan.beelzebub.entity.system.Position;
import com.wuhainan.beelzebub.service.system.PositionService;
import com.wuhainan.beelzebub.utils.PageInfo;
import com.wuhainan.beelzebub.utils.TableData;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <br>Created by 吴海南 on 2017-12-18.
 * <br>星期一 at 上午 10:11.
 */
@RestController
@RequestMapping("api")
public class PositionController {
    @Resource
    private PositionService positionService;
    @RequestMapping("positionPage")
    public TableData PositionPage(PageInfo pageInfo, Position position){
        return positionService.findPositionPage(pageInfo,position);
    }
    @RequestMapping("position/{id}")
    public Position Position(@PathVariable String id) {
        return positionService.findPositionById(id);
    }

    @RequestMapping("savePosition")
    public void savePosition(@RequestBody Position position) {
        positionService.savePosition(position);
    }

    @RequestMapping("deletePosition")
    public void deletePosition(@RequestBody Position position) {
        positionService.deletePosition(position);
    }

}
